
n = int(input("请输入第一个数："))
m = int(input("请输入第二个数："))

min = 0
max  =0
if n>m:
    min = m
    max = n
else:
    min = n
    max = m

yueshu = 0
beishu = 1
for i in range(1,min+1):
    if min%i==0 and max%i==0:
        yueshu = i

while True:
    if beishu%max==0 and beishu%min==0:
        break
    else:
        beishu = beishu + 1

print(yueshu,beishu)
